#pragma once

#include "generator-support.h"
#include <list>

using namespace std;

namespace cccn 
{

/// create a complete graph with number of nodes n
Graph CreateCompleteGraph (uint n);

/**
 * add two nodes and three edges into the given graph g and return all possible resultant graphs.
 *
 * \param g a graph whose nodes are all degree 3
 * \param minGirth skip a resulting graph if the new nodes so connected create a circuit shorter than minGirth 
 * \return all possible resultant graphs after nodes and edges are added into g
 */
list<Graph> GrowGraph_k3 (const Graph& g, uint minGirth = 0);

/**
 * reconnect some edges into the graph g so that all node degree equals to the same value.
 * Note that the degree k of all nodes in the graph must be an odd number
 * 
 * \para g a resultant graph from GrowGraph_k3
 * \return all possible resultant graphs by doing such reconnection on the given graph g
 */
list<Graph> ReconnectGraph_odd_k (const Graph& g);

/**
 * \return length of a minimum circuit of a graph. 0 is returned if the graph is a tree
 */
uint CalculateMinCircuitLength (Graph& g);

/**
 * \return length of a minimum circuit of every vertex of a graph g. These girth values
 * are also stored into the vertex_girth_t internal property of the graph g
 */
vector<uint> CalculateAllMinCircuitLength (Graph& g);

/**
 * For each node, calculate the sum of all distances goingfrom the node to the others
 *
 * \para g the graph to be calculated
 * \return a vector of distance-sum for each node
 */
vector<uint> CalculateAllDistanceSum (Graph& g);

/**
 * Calculate the averaged of all node-to-node distance for the given graph
 *
 * \param g the graph to be calculated
 * \return the averaged distance
 */
double CalculateDistanceAverage (Graph& g);

/**
 * Generate a k = 3 tidy graph with number of nodes m, which is the largest even number no greater than n
 *
 * \param n bounding the number of nodes
 * \return A tidy graph m number of nodes
 */
Graph GenerateTidyGraph_k3 (uint n);

}; // namespace cccn